from wtforms_tornado import Form
from wtforms.fields import StringField
from wtforms.validators import DataRequired, Regexp

MOBILE_REGEX = "^1[358479]\d{9}$"


class SmsCodeForm(Form):
    mobile = StringField("手机号码", validators=[
        DataRequired(message="请输入手机号码"),
        Regexp(regex=MOBILE_REGEX, message="请输入合法的手机号码")
    ])
